package com.luojing.springcloud.config.orderdelay;

import java.util.concurrent.DelayQueue;
import org.springframework.stereotype.Component;

/**
 * 队列
 * @author luojing
 * @create 2018/10/29 9:11 AM
 **/
@Component
public class OrderDelayQueue {
  private DelayQueue<OrderDelayMsg> queue = new DelayQueue<OrderDelayMsg>();

  public synchronized OrderDelayMsg get() throws InterruptedException {
    return queue.take();
  }

  public void add(OrderDelayMsg orderDelayMsg){
    queue.add(orderDelayMsg);
  }


}
